/*<summary>
Created By : Preeti
Created On : 10/18/2008
Class Name : Nurse_LoadMapper
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/


using System.Xml;
using System.Data;
using System;
using Utils;
using System.Data.SqlClient;

namespace AdminController
{
    public class Nurse_DataLoader
    {
        public Nurse Get_Nurse_DATA(string NurseID)
        {
            Nurse objNurse = new Nurse();
            ezUtilsAdapter DBL = new ezUtilsAdapter();
            DataChecker dtc = new DataChecker();
            DataSet ds = new DataSet();


            try
            {
                ds = DBL.RunSPReturnDataSet("SP_GetNurse", "TR", new SqlParameter("@vchNurseID", NurseID));
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    objNurse.FullName = Convert.ToString(dr["FullName"]);
                    objNurse.Address = Convert.ToString(dr["Address"]);
                    objNurse.City = Convert.ToString(dr["City"]);
                    objNurse.State = Convert.ToString(dr["State"]);
                    objNurse.ZipCode = Convert.ToString(dr["ZipCode"]);
                    objNurse.MobilePhone = Convert.ToString(dr["MobilePhone"]);
                    objNurse.OfficePhone = Convert.ToString(dr["OfficePhone"]);
                    objNurse.HomePhone = Convert.ToString(dr["HomePhone"]);
                    objNurse.EmailAddress = Convert.ToString(dr["EmailAddress"]);
                    objNurse.EmergencyContactName = Convert.ToString(dr["EmergencyContactName"]);
                    objNurse.EmergencyContactPhone = Convert.ToString(dr["EmergencyContactPhone"]);
                    objNurse.Category = Convert.ToString(dr["Category"]);
                    return objNurse;
                }
                else
                {
                    return objNurse;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = String.Format(
                    "An Error Occurred While Loading the Nurse Information to the DB. Message: {0}", ex.Message);
                return objNurse;
            }
            finally
            {
                DBL.Dispose();
                dtc.Dispose();
                ds.Dispose();

            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }


    }
}